home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Textfiles / DotsBasicMacCracking1.0.sit / Dots Basic Mac Cracking 1.rsrc / TEXT_128.txt < prev    next >
Text File  |  1997-12-13  |  12KB  |  373 lines

  1.  
  2.                                                     ¬†Basic Mac PPC Cracking Part 1
  3.                                                             Cracking with Nosy
  4.  
  5. by Dot Com
  6. December 12, 1997
  7.  
  8. I have read many cracking tutorials and have noticed they are pretty hard to understand.  I first learned cracking thru Smeger's excellent text, "The Kool Krack Tutorial".  The learning curve was pretty tough at first but I will attempt to get you rolling as quickly as possible thru examples.  In this part we will use Nosy to bypass a typical serial number dialog box and other annoying alerts.  There are many different approaches to bypassing a dialog box but this is one basic method I use the most often because its damn easy.
  9.  
  10. Software you will need
  11.  
  12. You will need the following software before you begin this tutorial:
  13.  
  14. Resorcerer 2.0
  15. Nosy II 8/97
  16. Macsbug 6.5.4a3c1
  17. THINK Reference 2.0
  18. WebCollage 1.0
  19.  
  20. Resorcerer is a resource editor like ResEdit.  I prefer Resorcerer because of its excellent search features.  We will use Resorcerer to modify code and checkout dialog boxes. Nosy is a PPC disassembler and will convert all assembly code into something we can read and understand.  Macsbug is a debugger and dissassember that will allow us to see what code is executing.  You will not need Macsbug in this lesson but get it anyway. THINK Reference is a handy utility that tells you all about Mac Toolbox Traps (more on this in a bit). You will also need to locate a copy of StarNine's WebCollage 1.0 from your local warez site (it may also be downloadable from http://www.starnine.com).  This is the app that you are going to attempt to crack.
  21.  
  22. Basic Assembly Language
  23.  
  24. I have to admit that I know nothing about assembly language (I dont even know that the hell it is!) but I have not found it necessary to know a whole lot, so I wont bore you with all that stuff.  
  25.  
  26. There are really only 4 pieces of assembly knowledge that you really need to know (at least for now) with the first being conditional branches.
  27.  
  28. Conditional branches are lines of code that compare values and go to or "branch" to another line of code.  If your familiar with the old BASIC language its like an IF THEN statement.  IF <serialnumber> = <12345> THEN <linenumber>.  There are two types of branches we need to know which are BNE (branch if not equal) and BEQ (branch if equal).  The machine language equivalent codes for these are 40 and 41.  What the hell is machine language you say? Hell if I know! This will make sense later so bare with me.  We use branches to force the program to do something different from what it normally does, kinda like a detour. A condtional branch statement looks like this:
  29.  
  30. 4182 0014  bc   IF,cr0_EQ,laq_3
  31.  
  32. so this line of code branches if the value cr0 is equal and goes to procedure laq_3 (in Macsbug it will be a numeric value or line number, more on that later)
  33.  
  34. The next type of assembly we need to know is NOP which stands for No Operation.  This is basically a line that does nothing..our macs just skip over this line. The machine language equivalent is 6000.  We use this to delete lines of code. A NOP statement looks like this:
  35.  
  36. 6000 0000  nop 
  37.  
  38. A line that loads a procedure or subroutine is also a branch but I feel its a little different than a normal branch.  A BL or "branch load" is just like a GOSUB in ole BASIC and it looks like this:
  39.  
  40. 4BFF FFDD  bl    proc13
  41.  
  42. so this line of code will run all the code in proc13.
  43.  
  44. And last but not least we need to know LI.  What does LI do? I have no idea, but it means "Load Immediate" I believe. All I know is that they are useful for seeking out Dialog box ID numbers. A LI  statement looks like this:
  45.  
  46. 38A0 06A4  li    r5,$6A4
  47.  
  48.  
  49.  
  50.              Using Resorcerer
  51.              
  52.  
  53. Upon running WebCollage Editor we of course get the typical register me dialog box as shown in Figure 1.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. Well since we dont seem to have an authorization key handy I guess that where gonna have to bypass this dialog box somehow and get the program to load up for us.  Most (not all) dialog boxes in an application have a Dialog ID number.  We will use Resorcerer to locate this number. Load up Resorcerer and load in WebCollage Editor and select the DLOG Resource and we see Figure 2.
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. We find that Dialog number 1701 ‚Äúadd key dialog‚Äù is the problem. Sometimes they dont label there dialogs as did StarNine so you will have to load up each dialog and find the right one.  Now we need to convert the ID number into Hex so we can locate it in Nosy.  What is Hex anyway you say?  Well you guessed it, I dont know.  I guess its just numbers that assembly code can recognize, who knows?  Anyway go to the Edit Menu and select ‚ÄúValue Converter‚Äù and type in 1701 in the Long field as seen in Figure 3.
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. Now in Hex, 1701 = 06A5.  Now its time to load up Nosy and snoop around the Dialog traps and try to locate the annoying procedure that calls Dialog 1701.
  128.  
  129. Toolbox Traps
  130.  
  131. Smeger described Toolbox Traps better than I can:
  132.  
  133. The Toolbox is a set of routines that mac programmers can use to simplify common tasks, making writing code really simple 'cause you don't have to do anything.  A trap is a system routine that performs some sort of action, such as drawing a menu bar or a window.  Traps are stored within a program as a single instruction.  When the trap is called, the program will perform the trap, then continue execution normally.
  134.  
  135. Got That? Good.  For a complete listing of Toolbox Traps and what they do I use the THINK Reference app. You should be able to find it no problem.  The trap calls we are interested in are any traps relating to Dialog Boxes such as GetNewDialog, GetDialogItem, etc. GetNewDialog seems to be the best one and I use it everytime.
  136.  
  137. ¬†                    
  138.              Using Nosy
  139.  
  140.  
  141. Nosy is a great program that will disassemble the Data Fork (where PPC code is located) into a format that we can read.  First duplicate WebCollage Editor and rename the copy to just Editor (Nosy only accepts 20 character filenames) and load it into Nosy.  Select the <DF> when Nosy asks you to select a resource.  Press Continue for the Treewalk optons and let Nosy explore.  Nosy will take a few minutes and dissassemble the program.  The time it takes varies on the filesize.  Sometimes Nosy will not be able to dissassemble part of a program and Macsbug will have to be used instead which will be covered in Part 2 of this series.  In this case Nosy loads the Editor fine and we get a window displaying all the Code Blocks as in Figure 4.  Keep scrolling down and you will find all the Toolbox Traps used in the application.
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165. Scroll down until you find .GetNewDialog_GL_. Select it and press ‚åò-R (also under the Display Menu: Show Refs to).  This will show all procedures that reference the GetNewDialog trap.  We now get the window in Figure 5.
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173. Well we lucked out as only 3 procedures have new dialog calls.  Sometimes there can be 20 or more and you will have to snoop thru them all.  Anyway lets check out proc3233.  Select it and press ‚åò-D (also under Display:  Code Blk) and we get Figure 6.  Scroll down a bit until you find a BL for the .GetNewDialog_GL.
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199. Notice above the first GetNewDialog we have a:
  200.  
  201. 8C8C0: 3860 06A5       li       r3,$6A5
  202.  
  203. Thats our man as we see Hex ID 6A5 being loaded just before the dialog call.  Bypassing this routine should solve the problem right? Nope.  Notice the branch at address 8C8BC: bc   IF,cr0_EQ,mkg_1.  If we reroute that branch to mkg_1 it still loads the dialog and there are no branches at the start of proc3233 to bypass all of this.  So what do we do now?  We bypass this whole procedure altogether.  Scroll back up to the top of proc3233 and we see the following:
  204.  
  205. ;-refs - proc3232  proc3250
  206.  
  207. This shows all the references to this procedure. Lets ‚åò-D proc3232 and we see that nothing is apparant but the BL to proc3233.  What we want to find is a conditional branch before loading proc3233.  Its not here so lets checkout the only ref to proc3232 which is proc3231.  Well no conditional branches in proc3231 as well but an interesting LI line referencing $6A4.  If we type 6A4 into the Value Converter in Resorcerer we find that its doing something with Dialog 1700 ‚Äúkey list dialog‚Äù, definetly something we want to avoid.  The only ref to this procedure is proc20, lets check it out.  Well, proc20 is a big one. Do a search for proc3231 with a ‚åò-F.  Type in proc3231 and it we find the contents in Figure. 7.
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241. If we keep clicking the Find button we see that this is the only occurance of proc3231 in this procedure.  Well there it is; a conditional branch above the call to proc3231:
  242.  
  243. 4182 0048      1001DA8    bc       IF,cr0_EQ,lau_9
  244.  
  245. Notice the NoteAlert in Figure 7, the LI above it calls $14D.  Go back to the Value Converter in Resorcerer and type in 14D and we get 333.  Select the ALRT (Alert dialogs are located here) resource type and double click on 333 and we get a nice ALRT saying that "None of the authorization keys are valid. 
  246. Please contact StarNine for more information".  Well this has got to be the right place.  It looks like if we force the application to reroute to lau_9 then we should avoid the serial number dialog box and the ALRT.  All we have to do is change it from a BEQ to a BNE.  How do we do that? Easy. First lets examine the code around the line we want to change:
  247.  
  248. 4808 D7B5      108F508       bl       proc3267
  249. 6000 0000                 nop 
  250. 7C60 0735                          extsh.   r0,r3 
  251. 4182 0048      1001DA8          bc       IF,cr0_EQ,lau_9
  252. 3860 FFFF                 li       r3,-1
  253. 3880 004C                 li       r4,76
  254.  
  255. See the number 41820048?  That is the assembly code for this line.  What we are going to do is search the <DF> in Resorcerer for this line.  What we find is that there are many 41820048‚Äôs in the <DF> so we need to copy down the surrounding code so we make sure we are in the right place.  The surrouding code would be 600000007C600735418200483860FFFF3880004C 
  256.  
  257. Modifiying Code in Resorcerer
  258.  
  259. To make the change we will use Resorcerer.  In Resorcerer and select the <DF> resource type and do a ‚åò-F and copy in the code with NO spaces in between the codes as in Figure 8.
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281. Select the ‚ÄúOf Type <DF>‚Äù and ‚ÄúHex‚Äù checkboxes and click Find. What we get is the window in Figure 9. 
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304. Now we are going to change 41820048 to 40820048, the exact opposite (a BEQ to a BNE).  Select the first two digits (41) of the code and type in 40.  
  305.  
  306. Completing the Crack
  307.  
  308. Close out of everything and save changes and lets see what happens.  Well our crack is still not complete  as ole ALRT 333 still pops up.  We did, however, got rid of the serial dialog. Lets go back to Nosy and checkout all the refs to .NoteAlert_GL_ and we find only two: proc6 and proc20.  Well we already bypassed the call in proc20 so lets checkout proc6 and lo and behold we have a conditional branch above the LI call to ALRT $14D in Figure 10.
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353. Again, it looks like if we change:
  354.  
  355. 4182 0044      10008A0   bc   IF,cr0_EQ,lag_1
  356.  
  357. we can bypass the ALRT.  Do the same as before and copy the code around it and make the change to 4182044 to 4082004 and see what happens.
  358.  
  359. Bingo! the program loads up with no problems.  One thing you might notice is the menu command ‚ÄúEdit Authorization Keys‚Äù under the Edit menu.  You might want to modify the Edit menu in Resorcerer under the MENU resource type and delete it.  This will make sure that nobody can get to any annoying serial number number dialogs and have the program quit.
  360.  
  361. Adios
  362.  
  363. Hopefully this was helpful and you are well on your way to cracking your own software.  You can now apply your newly learned cracking skills to the WebCollage Assembler. 
  364.  
  365. In Part 2 we will cover basic Macsbug cracking when Nosy poops out on us (a common occurance).  If you need help or have questions you can usually find me on #macfilez.
  366.  
  367. Good Luck,
  368.  
  369. Dot Com
  370.  
  371. Special thanks to sm00th who got me started in cracking and Dream for giving me inspiration to write this.
  372.  
  373.